package com.rainy.micservice.consumer.action;

import com.rainy.micservice.feignclient.DemoClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;

@RestController
@EnableEurekaClient
@RequestMapping("/index")
public class DemoController {

    @Autowired
    private DemoClient demoClient;

    @GetMapping("/home")
    public String home(HttpSession session) {
        System.out.println(demoClient.home());
//        try {
//            //测试zuul熔断效果
//            Thread.sleep(1000);
//        } catch (InterruptedException e) {
//            e.printStackTrace();
//        }
        return "controller 请求完成。";

    }
}
